Skip to content

freshness ui #29297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 16, 2025
Merged

freshness ui #29297

merged 4 commits into from
Apr 16, 2025

Conversation

jamiedemaria
Copy link
Contributor

@jamiedemaria jamiedemaria commented Apr 15, 2025

Summary & Motivation

Adds helper text for freshness health

  • NOT_APPLICABLE - "No freshness policy defined"
  • UNKNOWN - no text
  • DEGRADED - "Last materialized at " or "No materializations" if the asset has never been materialized
  • WARNING - "Last materialized at " or "No materializations" if the asset has never been materialized
  • HEALTHY - no text

How I Tested These Changes

Screenshot 2025-04-16 at 12 12 41 PM Screenshot 2025-04-16 at 12 13 17 PM

(ignore the strange time in these screenshots, that has been fixed)
Screenshot 2025-04-16 at 12 36 35 PM

Screenshot 2025-04-16 at 12 39 52 PM

Changelog

Insert changelog entry or delete this section.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Apr 15, 2025

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-g8i2ew26i-elementl.vercel.app
https://jamie-freshness-health-uis.core-storybook.dagster-docs.io

Built with commit 187a8b7.
This pull request is being automatically deployed with vercel-action

@jamiedemaria jamiedemaria force-pushed the jamie/freshness-health-uis branch from 5a7a60e to 56030c0 Compare April 16, 2025 16:41

return (
<Body>
Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp)).fromNow()} ago
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salazarm i don't know why, but this is giving me output like 55 days ago (see the screenshots in the description) - i checked the GQL query response and the timestamp is correct (example 1744821283.3374982) so i must be doing some incorrect conversion here?

@jamiedemaria jamiedemaria marked this pull request as ready for review April 16, 2025 16:42
@jamiedemaria jamiedemaria requested a review from salazarm April 16, 2025 16:42

return (
<Body>
Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp)).fromNow()} ago
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dayjs.fromNow() method already includes the word "ago" in its output for past dates (e.g., "5 minutes ago"). Adding " ago" after this call creates redundant text like "5 minutes ago ago". Consider removing the trailing " ago" to display the correct time format:

Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp)).fromNow()}
Suggested change
Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp)).fromNow()} ago
Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp)).fromNow()}

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@salazarm salazarm requested a review from a team as a code owner April 16, 2025 18:21
@salazarm salazarm removed the request for review from a team April 16, 2025 18:42
Comment on lines +255 to +256
Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp * 1000)).fromNow()}{' '}
ago
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be an issue with the timestamp conversion. The code is multiplying metadata.lastMaterializedTimestamp by 1000 (converting seconds to milliseconds), but dayjs.fromNow() already expects the timestamp to be in the correct format.

If lastMaterializedTimestamp is in Unix seconds (which appears to be the case based on the multiplication), the correct approach would be to use:

dayjs.unix(metadata.lastMaterializedTimestamp).fromNow()

This will properly handle the Unix timestamp in seconds without needing manual conversion. Alternatively, if manual conversion is preferred, ensure the conversion is appropriate for how fromNow() expects to receive timestamps.

The current implementation will display times that are off by a factor of 1000, which could lead to confusing user experiences.

Suggested change
Last materialized {dayjs(Number(metadata.lastMaterializedTimestamp * 1000)).fromNow()}{' '}
ago
Last materialized {dayjs.unix(metadata.lastMaterializedTimestamp).fromNow()}{' '}

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@jamiedemaria jamiedemaria force-pushed the jamie/freshness-health-uis branch from 13b5659 to 187a8b7 Compare April 16, 2025 19:18
@jamiedemaria jamiedemaria merged commit 65ee106 into master Apr 16, 2025
7 checks passed
@jamiedemaria jamiedemaria deleted the jamie/freshness-health-uis branch April 16, 2025 19:43
jamiedemaria added a commit that referenced this pull request Apr 18, 2025
## Summary & Motivation
Adds helper text for freshness health

- `NOT_APPLICABLE` - "No freshness policy defined"
- `UNKNOWN` - no text
- `DEGRADED` - "Last materialized at <timestamp>" or "No
materializations" if the asset has never been materialized
- `WARNING` - "Last materialized at <timestamp>" or "No
materializations" if the asset has never been materialized
- `HEALTHY` - no text

## How I Tested These Changes
<img width="384" alt="Screenshot 2025-04-16 at 12 12 41 PM"
src="https://github.com/user-attachments/assets/ccd18caf-1f20-464b-8bef-61f51338ad88"
/>
<img width="384" alt="Screenshot 2025-04-16 at 12 13 17 PM"
src="https://github.com/user-attachments/assets/ad5edd69-8b11-417e-8988-6d89a2e9749f"
/>

(ignore the strange time in these screenshots, that has been fixed)
<img width="384" alt="Screenshot 2025-04-16 at 12 36 35 PM"
src="https://github.com/user-attachments/assets/58b05dce-4a89-462c-b981-28bdda13ba71"
/>

<img width="384" alt="Screenshot 2025-04-16 at 12 39 52 PM"
src="https://github.com/user-attachments/assets/6f16da5e-ca80-44ee-a641-6ba0eb789aaa"
/>

---------

Co-authored-by: Marco Salazar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants